package com.jyu.apts.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name="organization")
public class Organization {
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE)
	long id;//主键
	@Column(unique=true)
	String name;//名称
	@Column
	String province;//省份
	@Column
	String city;//城市
	@Column
	String banner;//大图
	@Column
	String logo;//logo
	@Column
	String address;//地址
	@Column
	String phone;//联系电话
	@Column
	String email;//邮箱
	@Column
	long hot = 0;//热度
	@Lob//不使用默认类型longtext
    @Column(columnDefinition="text")
	String description;//描述
	@Column
	String part;//区/县
	@Column
	String latitude;//纬度
	@Column
	String longitude;//经度
	@OneToMany(mappedBy="organization",cascade={CascadeType.REMOVE})//级联删除人员
	List<User> users;
	@OneToMany(mappedBy="organization",cascade={CascadeType.REMOVE})//级联删除商品
	List<Item> items;
	@OneToMany(mappedBy="organization",cascade={CascadeType.REMOVE})//级联删除商品
	List<OrganizationRole> organizationRoles;
}
